@using mvcdemo07.Models
@model Student

<table>
    @if (Model == null)
    {
        <tr>
            <td>姓名:<input type="text" name="name" /></td>
        </tr>
        <tr>
            <td>年龄:<input type="text" name="age" /></td>
        </tr>
        <tr>
            <td>
                班级编号:<select name="classid">
                        <option value="1">1班</option>
                        <option value="2">2班</option>
                        <option value="3">3班</option>
                    </select>
            </td>
        </tr>

    }
    else
    {
        <tr hidden>
            <td>id:<input type="text" name="id" value="@Model.Id" /></td>
        </tr>
        <tr>
            <td>姓名:<input type="text" name="name" value="@Model.Name" /></td>
        </tr>
        <tr>
            <td>年龄:<input type="text" name="age" value="@Model.Age" /></td>
        </tr>
        <tr>
            <td>
                班级编号:<select name="classid">
                        <option value="1">1班</option>
                        <option value="2">2班</option>
                        <option value="3">3班</option>
                    </select>
            </td>
        </tr>
    }
    <tr>
        <td>
            <button onclick="btnsave()">保存</button>
            <button onclick="btnback()">返回</button>      
        </td>
    </tr>
</table>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="~/js/base.js"></script>